package com.pvj.myaccount.room

import android.app.Application
import androidx.room.Room
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.pvj.myaccount.room.database.AppDatabase

class DbHelper {

    companion object {
        @Volatile
        var INSTANCE: AppDatabase? = null

        fun init(context: Application) {
            INSTANCE = Room.databaseBuilder(
                context,
                AppDatabase::class.java, "account_db"
            )
           //     .addMigrations(MIGRATION_1_2)
            .build()
        }

//        private val MIGRATION_1_2 = object : Migration(1, 2) {
//            override fun migrate(db: SupportSQLiteDatabase) {
//                db.execSQL("ALTER TABLE cost ADD COLUMN is_regular INTEGER  NOT NULL DEFAULT 0")
//            }
//        }

    }
}